function [time, pw2, W] = main_WPCA(I)   
    [I_rows, I_cols] = size(I{1,1});
    F = length(I);
    I_ = zeros(I_rows, I_cols, F);
    for f = 1:length(I)
        I{f,1}(isnan(I{f,1})) = 0;
        I_(:,:,f) = I{f,1};
    end
    tic;
    [pw,Mod,PC] = kreisDemod(I_(:,:,1),I_(:,:,2));
    seed = PC;
    %alpha
    alpha = 2;
    %Number of Principal Components
    K = 2;
    Mask = true(I_rows, I_cols);
    [pw2,Mod,PC2,V2,W] = pcaWDemod(I_,K,Mask,seed,alpha);
    W = W./sum(W);
    A = mean(I_(:)).*ones(I_rows, I_cols);
    Delta = zeros(1,F);
    for f = 1:F
        Delta(f) = mod((f-1),F)*pi*2/F;
    end
    time = toc;
end
